package com.bwie.controller;

import com.bwie.pojo.TbProd;
import com.bwie.pojo.TbProdAtta;
import com.bwie.pojo.TbProdInfo;
import com.bwie.service.TbProdService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import io.swagger.models.auth.In;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: zhaijiaqi
 * @Date: 2025/7/19 08:37
 * @Description:
 **/
@RestController
@RequestMapping("/prod/index")
public class IndexController {

    @Autowired
    TbProdService tbProdService;

    /**
     * 分页商品列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getprodListPage")
    public R getprodListPage(@RequestBody PageInfoVo pageInfoVo){
        return tbProdService.getprodListPage(pageInfoVo);
    }

    /**
     * 批量删除
     * @param prodList
     * @return
     */
    @PostMapping("/getDeleteBatch")
    public R getDeleteBatch(@RequestBody List<TbProd> prodList){
        return tbProdService.getDeleteBatch(prodList);
    }

    /**
     * 字典表数据
     * @param typeId
     * @return
     */
    @PostMapping("/getDictList/{typeId}")
    public R getDictList(@PathVariable("typeId") Integer typeId){
        return tbProdService.getDictList(typeId);
    }

    /**
     * 添加商品
     * @param tbProd
     * @return
     */
    @PostMapping("/getAddProd")
    public R getAddProd(@RequestBody TbProd tbProd){
        return tbProdService.getAddProd(tbProd);
    }

    /**
     * 添加商品附件
     * @param tbProdAtta
     * @return
     */
    @PostMapping("/getAddProdAtta")
    public R getAddProdAtta(@RequestBody TbProdAtta tbProdAtta){
        return tbProdService.getAddProdAtta(tbProdAtta);
    }

    /**
     * 商品详情表
     * @param
     * @return
     */
    @PostMapping("/getProdInfoList")
    public R getProdInfoList(@RequestBody PageInfoVo pageInfoVo){
        return tbProdService.getProdInfoList(pageInfoVo);
    }

    /**
     * 获取商品明细
     * @param prodId
     * @return
     */
    @PostMapping("/getProdandInfoListById/{prodId}")
    public R getProdandInfoListById(@PathVariable("prodId") Integer prodId){
        return tbProdService.getProdandInfoListById(prodId);
    }

    /**
     * 商品明细添加
     * @param tbProdInfo
     * @return
     */
    @PostMapping("/getAddProdInfo")
    public R getAddProdInfo(@RequestBody  TbProdInfo tbProdInfo){
        return tbProdService.getAddProdInfo(tbProdInfo);
    }

}
